CC = gcc
SCRC = $(wildcard *.c)
OBJS_DIR = ./obj
OBJ = $(SCRC:%.c=$(OBJS_DIR)/%.o)
CFLAGS = -Wall -O2
LDFLAGS = -lpthread
TARGET = main

# 默认目标
all: $(TARGET)

$(TARGET):$(OBJ)
	$(CC) $^ -o $@ $(LDFLAGS)
$(OBJS_DIR)/%o:%c
	@mkdir -p $(OBJS_DIR)
	$(CC) $< -o $@	$(CFLAGS) -c 
	

echo:
	@echo $(OBJ)

clean:
	rm -rf ./obj

.PHONY:clean
.PHONY:echo
